<?php

/**
 * This is the model class for table "tbl_contract_sofware_maint_ledger".
 *
 * The followings are the available columns in table 'tbl_contract_sofware_maint_ledger':
 * @property integer $id
 * @property string $contractid
 * @property string $software_platform
 * @property string $software_product_id_1
 * @property string $maintenance_rate_1
 * @property string $maintenance_rate_price_1
 * @property string $software_id_2
 * @property string $maintenance_rate_2
 * @property string $maintenance_rate_cost2
 * @property string $total_maintenance_rate
 * @property string $total_maintenance_price
 * @property string $coverage
 */
class ContractSofwareMaintLedger extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return ContractSofwareMaintLedger the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tbl_contract_sofware_maint_ledger';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('contractid, software_platform, software_product_id_1, maintenance_rate_1, maintenance_rate_price_1, software_id_2, maintenance_rate_2, maintenance_rate_cost2, total_maintenance_rate, total_maintenance_price, coverage', 'required'),
			array('contractid', 'length', 'max'=>41),
			array('software_platform', 'length', 'max'=>255),
			array('software_product_id_1, software_id_2', 'length', 'max'=>150),
			array('maintenance_rate_1, maintenance_rate_price_1, maintenance_rate_2, maintenance_rate_cost2, total_maintenance_rate, total_maintenance_price', 'length', 'max'=>10),
			array('coverage', 'length', 'max'=>100),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, contractid, software_platform, software_product_id_1, maintenance_rate_1, maintenance_rate_price_1, software_id_2, maintenance_rate_2, maintenance_rate_cost2, total_maintenance_rate, total_maintenance_price, coverage', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'contractid' => 'Contractid',
			'software_platform' => 'Software Platform',
			'software_product_id_1' => 'Software Product Id 1',
			'maintenance_rate_1' => 'Maintenance Rate 1',
			'maintenance_rate_price_1' => 'Maintenance Rate Price 1',
			'software_id_2' => 'Software Id 2',
			'maintenance_rate_2' => 'Maintenance Rate 2',
			'maintenance_rate_cost2' => 'Maintenance Rate Cost2',
			'total_maintenance_rate' => 'Total Maintenance Rate',
			'total_maintenance_price' => 'Total Maintenance Price',
			'coverage' => 'Coverage',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('contractid',$this->contractid,true);
		$criteria->compare('software_platform',$this->software_platform,true);
		$criteria->compare('software_product_id_1',$this->software_product_id_1,true);
		$criteria->compare('maintenance_rate_1',$this->maintenance_rate_1,true);
		$criteria->compare('maintenance_rate_price_1',$this->maintenance_rate_price_1,true);
		$criteria->compare('software_id_2',$this->software_id_2,true);
		$criteria->compare('maintenance_rate_2',$this->maintenance_rate_2,true);
		$criteria->compare('maintenance_rate_cost2',$this->maintenance_rate_cost2,true);
		$criteria->compare('total_maintenance_rate',$this->total_maintenance_rate,true);
		$criteria->compare('total_maintenance_price',$this->total_maintenance_price,true);
		$criteria->compare('coverage',$this->coverage,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}